<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!-- jQuery (Bootstrap 的所有 JavaScript 插件都依赖 jQuery，所以必须放在前边) -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    <title>Title</title>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <nav class="navbar navbar-default">
                <div class="container-fluid">
                    <!-- Brand and toggle get grouped for better mobile display -->
                    <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                            <span class="sr-only">Toggle navigation</span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                            <span class="icon-bar"></span>
                        </button>
                        <a class="navbar-brand" href="#">学生申请</a>
                    </div>

                    <!-- Collect the nav links, forms, and other content for toggling -->
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav">
                            <li class="active"><a href="/student/stuReqForm">请假</a></li>
                            <li><a href="/student/myLeave">请假记录</a></li>
                        </ul>

                        <ul class="nav navbar-nav navbar-right">
                            <li class="dropdown">
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">欢迎您，${loginUser.name}<span class="caret"></span></a>
                                <ul class="dropdown-menu">
                                    <li><a href="/login/loginout">退出</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div><!-- /.navbar-collapse -->
                </div><!-- /.container-fluid -->
            </nav>

        </div>
    </div>
    <div class="row">
        <form class="form-horizontal" role="form" enctype="multipart/form-data"
              method="post" action="/student/upload">
            <div class="form-group">
                <label for="" class="col-sm-2 control-label">姓名</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="name" placeholder="${loginUser.name}" name="name" readonly>
                </div>
            </div>
            <div class="form-group">
                <label for="" class="col-sm-2 control-label">理由</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="res" placeholder="请假理由" name="reason">
                </div>
            </div>
            <div class="form-group">
                <label for="" class="col-sm-2 control-label">时间段</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control" id="" placeholder="例如2018.12.01 9：30-2018.12.01 12：30" name="period">
                </div>
            </div>
            <div class="form-group">
                <label for="" class="col-sm-2 control-label">请假类型</label>
                <div class="col-sm-10">
                    <select class="form-control" id="type" name="type">
                        <option value="1">生活请假</option>
                        <option value="2">课程请假</option>
                    </select>
                </div>
            </div>
            <div class="form-group"  style="display:none;" id="divl">
                <label for="" class="col-sm-2 control-label">请假课程</label>
                <div class="col-sm-10">
                    <select class="form-control" id="cid" name="courseid">
                        <#list curses as curse>
                        <option value="${curse.id}">${curse.name}</option>
                    </#list>
                    </select>
                </div>

            </div>

            <div class="form-group">
                <label for="" class="col-sm-2 control-label">上传证明</label>
                <input type="file" id="exampleInputFile" name="picfile">
                <p class="help-block">Example block-level help text here.</p>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-success">提交申请</button>
                </div>
            </div>
        </form>

    </div>
</div>
</body>
<script>
$("#type").change(function () {
    var sel = $("#type").val();
    if(sel==1){
        $("#divl").hide();
    }else if(sel==2){
        $("#divl").show();
    }

});
</script>
</html>